#ifndef SingletonMod_H_
#define SingletonMod_H_

#include "WinLock.h"

template <class S>
class cSingletonMod
{
public:
	cSingletonMod() : _ps(0)
	{
	}

	~cSingletonMod()
	{
		delete _ps;
	}

	S* get()
	{
		if(NULL == _ps)
		{
			WinLock::ScopeLock lock(_m);
			if(NULL == _ps) _ps = new S;
		}

		return _ps;
	}

private:
	WinLock _m;
	S *_ps;
};


#endif
